import request from '@/api/request'

export function get_person_info(openid){
  const res = request({
    url: `/service/person/${openid}`,
    method: 'GET',
  })
  return res
}
// 私人律师增加
export function private_contract_add(contractInfo){
  const res = request({
    url: '/service/private/',
    method: 'POST',
    data: contractInfo
  })
  return res
}
// 私人律师更新
export function private_contract_update(contractInfo){
  const res = request({
    url: `/service/private/${contractInfo.id}/`,
    method: 'PATCH',
    data: contractInfo
  })
  return res
}
// 私人律师确认
export function private_contract_confirm(contractInfo){
  const res = request({
    url: `/service/private/${contractInfo.id}/`,
    method: 'PATCH',
    data: contractInfo
  })
  return res
}
// 私人律师详情
export function private_contract_info(contract_id){
  const res = request({
    url: `/service/private/${contract_id}/`,
    method: 'GET',
  })
  return res
}
// 私人律师列表
export function private_contract_list(){
  const res = request({
    url: '/service/private/',
    method: 'GET'
  })
  return res
}
// 私人律师删除
export function private_contract_delete(contract_id){
  const res = request({
    url: `/service/private/${contract_id}/`,
    method: 'DELETE'
  })
  return res
}
// 显示二维码
export function show_qrcode(url){
  const res = request({
    url: '/wechat/api/qrcode',
    method: 'GET',
    responseType: 'arraybuffer', 
    params:{url: url}
  })
  return res
}

// 显示二维码
export function show_bg_qrcode(params){
  const res = request({
    url: '/wechat/api/qrbgcode',
    method: 'GET',
    responseType: 'arraybuffer', 
    params: params
  })
  return res
}

// 公司信息
export function get_company_info(openid){
  const res = request({
    url: `/service/company/${openid}`,
    method: 'GET',
  })
  return res
}
// 法律顾问增加
export function adviser_contract_add(contractInfo){
  const res = request({
    url: '/service/adviser/',
    method: 'POST',
    data: contractInfo
  })
  return res
}
// 法律顾问列表
export function adviser_contract_list(){
  const res = request({
    url: '/service/adviser/',
    method: 'GET'
  })
  return res
}
// 法律顾问删除
export function adviser_contract_delete(contract_id){
  const res = request({
    url: `/service/adviser/${contract_id}/`,
    method: 'DELETE'
  })
  return res
}

// 法律顾问详情
export function adviser_info(contract_id){
  const res = request({
    url: `/service/adviser/${contract_id}/`,
    method: 'GET',
  })
  return res
}

// 合同金额列表
export function adviser_amount_list(){
  const res = request({
    url: '/service/amount/',
    method: 'GET',
  })
  return res
}

// 法律顾问金额更新
export function adviser_amount_update(contractInfo){
  const res = request({
    url: `/service/adviser/${contractInfo.id}/`,
    method: 'PATCH',
    data: contractInfo
  })
  return res
}

// 法律顾问确认
export function adviser_confirm(contractInfo){
  const res = request({
    url: `/service/adviser/${contractInfo.id}/`,
    method: 'PATCH',
    data: contractInfo
  })
  return res
}

// 代理授权公司列表
export function agency_company_list(){
  const res = request({
    url: '/service/agency/',
    method: 'GET'
  })
  return res
}

// 代理授权
export function agency_company_info(company_id){
  const res = request({
    url: `/service/agency/${company_id}/`,
    method: 'GET'
  })
  return res
}

// 代理授权增加
export function agency_company_add(companyInfo){
  const res = request({
    url: `/service/agency/`,
    method: 'POST',
    data: companyInfo
  })
  return res
}

// 代理授权修改
export function agency_company_update(companyInfo){
  const res = request({
    url: `/service/agency/${companyInfo.id}/`,
    method: 'PATCH',
    data: companyInfo
  })
  return res
}

// 代理授权修改
export function agency_company_confirm(company_id){
  const res = request({
    url: `/service/agency/${company_id}/`,
    method: 'GET',
  })
  return res
}

// 私人律师合同金额列表
export function private_amount_list(){
  const res = request({
    url: '/service/pri_amount/',
    method: 'GET',
  })
  return res
}

export function addCompanyPerson(data){
  const res = request({
    url: '/service/agency_person/',
    method: 'POST',
    data
  })
  return res
}

// 发卡授权列表
export function card_agency_list(){
  const res = request({
    url: '/service/card_agency/',
    method: 'GET',
  })
  return res
}

// 发卡授权详情
export function card_agency_info(user_id){
  const res = request({
    url: `/service/card_agency/${user_id}/`,
    method: 'GET'
  })
  return res
}

// 发卡授权增加
export function card_agency_add(data){
  const res = request({
    url: '/service/card_agency/',
    method: 'POST',
    data
  })
  return res
}

// 发卡授权增加
export function card_agency_update(data){
  const res = request({
    url: `/service/card_agency/${data.id}/`,
    method: 'PUT',
    data
  })
  return res
}

// 发卡授权删除
export function card_agency_delete(agency_id){
  const res = request({
    url: `/service/card_agency/${agency_id}/`,
    method: 'DELETE',
  })
  return res
}

// 发卡
export function card_consult_add(data){
  const res = request({
    url: '/service/consult_card/',
    method: 'POST',
    data
  })
  return res
}

// 发卡列表
export function card_consult_list(){
  const res = request({
    url: '/service/consult_card/',
    method: 'GET',
  })
  return res
}

// 发卡列表
export function card_consult_detail(card_id){
  const res = request({
    url: `/service/consult_card/${card_id}/`,
    method: 'GET',
  })
  return res
}

// 咨询卡确认
export function card_consult_update(data){
  const res = request({
    url: `/service/consult_card/${data.id}/`,
    method: 'PATCH',
    data
  })
  return res
}

// 第三方代理公司信息(名称查询)
export function company_info_by_name(params){
  const res = request({
    url: '/service/companyinfo/',
    method: 'GET',
    params
  })
  return res
}
// 电话薄
export function contact(params){
  const res = request({
    url: '/service/contact/',
    method: 'GET',
    params
  })
  return res
}
export function contact_next(url){
  const res = request({
    url: url,
    method: 'GET',
  })
  return res
}